package src.stu23002123.chapter07;

import java.util.*;


/**
 * Date:2023.11.9
 * Author:张子阳
 * */

public class Demo_Collection {
    public static void main(String[] args) {
        HashSet hashSet = new HashSet();
        Student stu = new Student(23002123,"张子阳");
        hashSet.add("张");
        hashSet.add("子");
        hashSet.add("阳");
        hashSet.add(stu);
        Iterator it = hashSet.iterator();
        while(it.hasNext()) {
           System.out.println(it.next());
        }


    }
}

class  Student{
    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    public Student(int id, String name) {
        this.id = id;
        this.name = name;
    }

    int id;
    String name;

}





